//
//  HLIMKitInputBar.h
//  YueYue
//
//  Created by hulu001 on 2024/1/12.
//

#import <UIKit/UIKit.h>
#import "NIMGrowingTextView.h"
#import "HLIMInputViewProtocol.h"
#import "HLIMKitQuoteView.h"

NS_ASSUME_NONNULL_BEGIN
@class HLIMKitInputMoreItem;
@class HLIMKitAction;

@protocol HLIMKitInputBarDelegate <NSObject>

- (BOOL)textViewShouldBeginEditing;

- (void)textViewDidEndEditing;

- (BOOL)shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)replacementText;

- (void)textViewDidChange;

- (void)toolBarWillChangeHeight:(CGFloat)height;

- (void)toolBarDidChangeHeight:(CGFloat)height;

- (void)sendText:(NSString *)text;

@end


@interface HLIMKitInputBar : UIView <NIMGrowingTextViewDelegate, HLIMKitQuoteViewDelegate>

@property (nonatomic, strong) UIView *bg;
@property (nonatomic, weak) UIButton *voiceButton;  // 切换键盘录音
@property (nonatomic, weak) UIButton *moreButton;   // 更多按钮
@property (nonatomic, weak) UIButton *emojiButton;  // 表情键盘
@property (nonatomic, weak) UIButton *recordVoiceButton; // 录音按钮
@property (nonatomic, weak) UILabel *recordVoiceLabel; // 录音按钮
@property (nonatomic, strong) UIButton *sendButton;   // 发送
@property (weak, nonatomic) UIButton *audioRecognizeButton; // 语音听写
@property (weak, nonatomic) UIButton *audioRecoCancelButton;// 语音听写取消
@property (strong, nonatomic) HLIMKitQuoteView *quoteView;
@property (weak,    nonatomic) UIButton *realVoiceButton;

@property (assign, nonatomic) id<HLIMKitInputBarDelegate> delegate;

@property (nonatomic,copy) NSString *contentText;
@property (nonatomic,strong) NIMGrowingTextView *inputTextView;

@property (assign, nonatomic) BOOL showKeyboard;

- (instancetype)initWithFrame:(CGRect)frame delegate:(id<HLIMKitInputBarDelegate>)delegate;

- (NSRange)selectedRange;

- (void)refreshStatus:(HLIMInputStatus)status;

- (void)insertText:(NSString *)text;

- (void)deleteText:(NSRange)range;

- (void)insertQuote:(NSString *)quote;
- (void)clearQuote;

/// 自定义控件，非+号展开内的button
- (void)addCustomButton;
/// 对自定义的控件进行事件绑定
- (void)addCustomTarget:(id<HLIMKitInputView>)target;
/// 默认0. 编辑文字时，只有输入框部分高度紧贴键盘。如果需要显示输入框以下的bar的其余部分，设置extraHeight
- (CGFloat)extraHeight;

@end

NS_ASSUME_NONNULL_END
